import Vue from 'vue'
import VueRouter from 'vue-router'
import Film from '../views/film/film.vue'
import Cinema from '../views/cinema/cinema.vue'
import News from '../views/news/news.vue'
import User from '../views/user/user.vue'
import Nowmv from '../views/film/nowmv.vue'
import Detail from '../views/detail/detail.vue'
import location from '../views/film/location.vue'
import Cinemas from '../views/film/cinemas.vue'
import Cinemasdetail from '../views/film/cinemasdetail.vue'
import CinemaDetailList from '../views/film/cinemaDetailList.vue'
import Login from '../views/film/login.vue'
import Select from '../views/user/select.vue'

Vue.use(VueRouter)

const routes = [{
        path: '/',
        redirect: { "name": "flim" },
        meta: {
            flag: true
        }
    },
    {
        path: '/film',
        name: 'flim',
        component: Film,
        meta: {
            flag: true
        },
        redirect: { "path": "/film/nowmv" },
        children: [{
                path: ":type",
                name: 'nowmv',
                component: Nowmv,
                meta: {
                    flag: true
                }
            },

        ]
    },
    {
        path: '/detail/:id',
        name: 'detail',
        component: Detail,
        meta: {
            flag: false
        }
    },
    {
        path: '/login/:lid',
        name: 'login',
        component: Login,
        meta: {
            flag: false
        }
    },
    {
        path: '/select/:sid',
        name: 'select',
        component: Select,
        meta: {
            flag: false
        }
    },
    {
        path: '/cinemas/:cinemaid',
        name: 'cinemas',
        component: Cinemas,
        meta: {
            flag: false
        }
    },
    {
        path: '/cinemasdetail/:detailid',
        name: 'cinemasdetail',
        component: Cinemasdetail,
        meta: {
            flag: false
        },
        redirect: { 'name': 'cinemaDetailList' },
        children: [{
            path: 'cinemaDetailList',
            name: "cinemaDetailList",
            component: CinemaDetailList
        }]
    },
    {
        path: '/location',
        name: 'location',
        component: location
    },
    {
        path: '/cinema',
        name: 'cinema',
        component: Cinema,
        meta: {
            flag: true
        }
    },
    {
        path: '/news',
        name: 'news',
        component: News,
        meta: {
            flag: false
        }
    },
    {
        path: '/user',
        name: 'user',
        component: User,
        meta: {
            flag: true
        }
    },
]

const router = new VueRouter({
    mode: 'history',
    base: process.env.BASE_URL,
    routes
})

export default router